package org.gd.redis;

import redis.clients.jedis.Connection;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class Test {

    public static void main(String...args) {
        /*System.out.println();
        System.out.println("====================================");
        System.out.println();
        Connection connection = new Connection();
        try {
            connection.setHost("127.0.0.1");
            connection.setPort(6379);
            connection.connect();
            for (Object o: connection.getAll()) {
                System.out.println(o.toString());
            }
        } finally {
            connection.disconnect();
        }*/


        JedisPoolConfig config = new JedisPoolConfig();

        JedisPool pool = new JedisPool(config, "localhost");
        try {
            Jedis jedis = pool.getResource();
            jedis.set("foo", "bar");
            System.out.println(jedis.get("foo"));


            //String foobar = jedis.get("foo");
            //assert foobar.equals("bar");
            //pool.returnResource(jedis);
        } finally {
            //pool.destroy();
        }
    }
}
